import {
	defineStore
} from 'pinia';
import api from '../api';

export const useUserStore = defineStore('user', {
	state: () => {
		return {
			isLogin: false
		};
	},
	actions: {
		setIsLogin(val) {
			this.isLogin = val
		},
		checkIsLogin() {
			return new Promise(async (resolve, rject) => {
				let res = await api.getUserInfo()
				if (res.data) {
					resolve(true)
				} else {
					resolve(false)
				}
			})
		}
	},
});